POST: http://www.nomedoseusite.com.br/api_products_others.php?action=add_products_options_values
Header Parameter | Format |
Usuario1 | base64_encode() |
Senha1 | base64_encode() |
Parameter | Format | Description |
products_id | JSON |
Number of products_id |
products_options >> products_options_id | JSON |
Number of products_options_id |
products_options_values >> products_options_values_id | JSON |
Number of products_options_values_id |
Note: When editing, you must submit all attribute and value options again, because all the attributes and values in the editing process are deleted.
PHP Sample
// sample add list product options and values $url = $domain_url . '/api_products_others.php?action=add_products_options_values'; $data_options_values[0] = array("products_options_values_id" => "35" ); $data_options_values[1] = array("products_options_values_id" => "30" ); $data_options[0] = array("products_options_id" => "4", "products_options_values" => $data_options_values ); $data = array("products_id" => "430", // Product ID (Only number is required) * FIELD REQUIRED "products_options" => $data_options ); $data_string = json_encode($data); $ch = curl_init($url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', "Cache-Control: no-cache", 'Usuario1: ' . base64_encode($usuario1), 'Senha1: ' . base64_encode($senha1), 'Content-Length: ' . strlen($data_string)) ); $result = curl_exec($ch); curl_close($ch); print_r($result); // sample add list product options and values eof
Return Error:
code
message
Return Success:
code
id
message